#----------------------------
# Name: Logan Stone
# Project: Madlibs.py
# Period: 2
# Start Date: 9/17/2013
# Last Revision Date: 10/7/2013
# Version: 1.3.0
#----------------------------

swearFilter = ["dumb",
               "stupid",
               "retard",
               "fuck",
               "shit",
               "gay",
               "faggot",
               "faggit",
               "cunt",
               "homo",
               "erotic",
               "nigger",
               "cracker",
               "ass",
               "asshole",
               "butt",
               "cock",
               "dick",
               "penis",
               "condom",
               "Vagina",
               "gynecologist",
               "tit",
               "tits",
               "titty",
               "kkk",
               "boobs",
               "breasts",
               "canada",
               "boobies",
               "tig ole bitties",
               "nickelback",
               "tah tah",
               "tee tee",
               "anal",
               "oral",
               "swears",
               "Call of Duty",
               "boner",
               "erection",
               "nipple",
               "piss",
               "urine",
               "damn",
               "muff",
               "damnit",
               "damm",
               "dammit",
               "godamnit",
               "goddammit",
               "goddam",
               "klu klux klan",
               "kkkkkk",
               "666",
               "simcity",
               "1337",
               "gooch",
               "gootch",
               "goochie",
               "gootchie",
               "gucci",
               "guci",
               "guccii",
               "guci",
               "hoes",
               "whores",
               "dryfuck",
               "dry fuck",
               "hump",
               "Lil",
               "Wayne",
               "Lil' Wayne",
               "Lil wayne",
               "everything",
               "curse words",
               "dirty words",
               "screw",
               "nail",
               "bang",
               "horny",
               "porn",
               "jizz",
               "semen",
               "sea men",
               "seamen",
               "seman",
               "seeman",
               "seemen",
               "jizzz",
               "jizzzzz",
               "breasts",
               "tamakeri",
               "hentai",
               "BDSM",
               "naughty",
               "bannana"
               "banana",
               "dickhead",
               "poop",
               "pee",
               "fuzz",
               "foosle",
               "hell",
               "Adolf",
               "Hitler",
               "Mein Fuher"
               "Syrius",
               "Voldemort",
               "Moldywort",
               "Adolf Hitler",
               "Joseph Stalin",
               "Stalin",
               "Mein Khampf",
               "Bastards",
               "bastard",
               "biatch",
               "bukkake",
               "69",
               "shitface",
               "fuckface",
               "assface",
               "bumface",
               "dickface",
               "gucciface",
               "cunface",
               "bastardface",
               "assholeface",
               "porno",
               "pornography",
               "racism",
               "spic",
               "spik",
               "spick",
               "ching",
               "chang",
               "chong",
               "cheech",
               "cha cha",
               "watermelon cornbread koolaid fried chicken",
               "shitfuck",
               "fuckshit",
               "fuckcunt",
               "satan",
               "lucifer",
               "devil",
               "motherfucker",
               "mothafucka",
               "MILF",
               "motherfucker",
               "snake",
               "fuckniggashitcuntbitchassmotherfucker",
               "9001",
               "9002",
               "over 9000",
               "vegeta",
               "toilet",
               "towelette",
               "condomjesus",
               "grandmother",
               "clam",
               "cookie clicker",
               "because i said so",
               ]
   
def displayStartScreen():
    print "Madlibs"
    raw_input("Press Enter to Continue")
    
def displayEndScreen():
    print "Goodbye"
    raw_input("Press Enter to Exit")

    
def getMenuOption(maxOption):
    option = ""
    goodOption = False
    while not goodOption:
        option = raw_input("Enter Number or Q : ")
        option = option.upper()
        for num in range(1, maxOption+1):
            if option == str(num):
                goodOption = True
        if option == 'Q':
            goodOption = True
        if option == '1464':
            goodOption = True
        if option == 'H':
            goodOption = True
        if not goodOption:
            print "You must pick a valid option!"
    return option

def menu(options):
    print "------Please Select a Story------"
    print " [1] Apocalypse at this moment in time."
    print " [2] Murderer in the Room."
    print " [3] The Most Epic Story of Epic!!!1!!!1!111!!!"
    print " [H] Hints!"
    print " [Q] Quit"
    print "----------------------------------"
    option = getMenuOption(options)
    return option

def getCode(prompt):
    scode = ""
    goodScode = False
    while not goodScode:
        scode = raw_input(prompt)
        if scode.lower() in secretCode:
            goodScode = True
        else:
            print "You have entered the wrong code... MadLibs will now quit..."
        if not goodScode:
            displayEndScreen()
    return scode
    
def getWord(prompt):
    word = ""
    goodWord = False
    while not goodWord:
        word = raw_input(prompt)
        if word.lower() not in swearFilter:
            goodWord = True
        else:
            print "HEY! That's rude... Don't do it again!"
        if not goodWord:
            print "Try again"
    return word
    
def getNumber(prompt, max = "", min = ""):
    num = ""
    goodNum = False
    while not goodNum:
        isNum = True
        num = raw_input(prompt)
        for character in num:
            if character not in "0123456789":
                isNum = False
        if min != "":
            if isNum:
                if float(num) < min:
                    isNum = False
        if max != "":
            if isNum:
                if float(num) > max:
                    isNum = False
        if isNum:
            goodNum = True
        else:
            print "Not a valid number, try again."
    return num
      
def story1():
    adj1 = getWord("Enter an adjective : ")
    verb1 = getWord("Enter a verb: ")
    verb2 = getWord("Enter a verb with an ing ending: ")
    verb3 = getWord("Enter another verb with an ing ending: ")
    verb4 = getWord("Enter one more verb with an ing ending: ")
    noun1 = getWord("Enter a noun: ")
    noun2 = getWord("Enter another noun: ")
    noun3 = getWord("Enter yet another noun: ")
    noun4 = getWord("Enter one last noun: ")
    noun6 = getWord("Enter vehicle: ")
    noun7 = getWord("Enter your closest friend: ")
    noun5 = getWord("Enter a celebrity you despise: ")
    
    story = "--------------------------------------------------------------------------------"
    story += "It was the end of the world, the sky was raining down "
    story += adj1 + " " + noun1 + "!"
    story += " People were " + verb2 + " out of the " + noun2 + "."
    story += " A horde of " + noun3 + " were " + verb3 + " a group of innocent " + noun4 + ". "
    story += "We were riding in " + noun6 + " with " + noun7 + " ,and " + noun5 + ". "
    story += noun4 + "was driving, and " + noun5 + " was riding in the back, when " + noun5 + " started talking about some stupid celebrity crap, so, I threw " + noun5 + " out of the " + noun6 + ". "
    story += "As " + noun5 + " was " + verb4 + noun5 + " got hit by a " + adj1 + " " + noun1 + ". "
    story += "I guess things work out after all, even in the end of the world."
    story += "--------------------------------------------------------"
    print story
    
def story2():
    place1 = getWord("Enter the name of a building: ")
    name1 = getWord("Enter a Name: ")
    name2 = getWord("Enter another Name: ")
    name3 = getWord("Enter yet another Name: ")
    name4 = getWord("Still Enter another Name: ")
    name5 = getWord("Okay, Enter one last Name: ")
    weap1 = getWord("Enter a murder weapon (preferebly close range, such as a knife) : ")
    weap2 = getWord("Yeah, we're going to need a better weapon...: ")
    weap3 = getWord("You know what, we'll just use what you give... but seriously this time, give me something awesome: ")
    adj1 = getWord("An adjective please : ")
    adj2 = getWord("Okay, last adjective :")
    story = "--------------------------------------------------------"
    story += "It was late at night in"
    story += " " + place1 + "."
    story += " " + name1 + ", "
    story += name2 + ", " 
    story += name3 + ", " 
    story += name4 + ", and "                                            
    story += name5 + " were all standing around."
    story += " When all of a sudden the lights went out. " + name3 + " was the first one to die."
    story += " Quickly after " + name3 + "'s death, " + name1 + " felt the " + adj1 + " of a " + weap1 + " slip into his/her back."
    story += " " + name2 + ", " + name5 + ", and " + name4 + " were all separated. " 
    story += name4 + " stumbled upon the bodies of " + name3 + ", and " + name1 + "." + " "
    story += "Unfortunately, " + name2 + " found " + name4 + " hunched over the bodies. "
    story += " " + "Ah-ha, cried " + name2 + " it was you who killed them. "
    story += name4 + " tried to explain, but it was too late, " + name2 + " armed with his/her trusty " + weap2 + " killed " + name4 + "."
    story += " " + name5 + " made it away without anyone knowing... "
    story += " The last thing " + name2 + " saw, was the " + adj2 + " " + weap3 + " in " + name5 + "'s bloody hands."
    story += "--------------------------------------------------------"
    print story

def story3():
    #pirate dragons with lazers attack space with michele obama.
    noun1 = getWord("Some creature which is super epic!!!! : ")
    noun2 = getWord("Give me something super awesome, like lazers, or bazooka's, or death rays :")
    noun3 = getWord("We need an awesome place to defend! : ")
    noun4 = getWord("A political celebrity please... :")
    noun5 = getWord("Enter a Stereotypical Antagonist : ")
    noun6 = getWord("What would this " + noun5 + " have as an army? : ")
    noun7 = getWord("What is the power artifact??? :")
    
    story = "------------------------------------------------------------------------------"
    story += "There once was a group of " + noun1 + "s, who had nothing to do."
    story += " All of a sudden the threat of " + noun5 + " loomed over the " + noun1 + "s. "
    story += "Fearing death, the " + noun1 + "s sought the help of " + noun4 + ". "
    story += "Using their knowledge of " + noun5 + ", " + noun4 + " suggested that the " + noun1 + "'s use " + noun2 + "'s. "
    story += "With " + noun5 + "'s army of " + noun6 + "s approaching, the " + noun1 + "s went to their battle-stations at " + noun3 + "!"
    story += "I want the " + noun7 + "!!! , cried " + noun5 + ", and you'll have to kill my entire army to keep it from me!!!"
    story += " Calmer than a monk on morphine, " + noun4 + " shot the first " + noun2 + ". "
    story += "The battle was epic, death and decay was spread throughout the field, and victory and justice was served that day. "
    story += " Victorious, the " + noun1 + "'s went back to their docile life, and " + noun4 + " continued their journey, and became the president of the United States of America. "
    story += "--------------------------------------------------------"
    print story

def storyS():
    name = getWord("Enter your Name: ")
    verb1 = getWord("Enter a past tense Verb: ")
    adj1 = getWord("Enter an Adjective: ")
    
    story = " There once was a player named " + name + " who found a secret story in their game. "
    story += "Expecting excitement they " + verb1 + " loaded the story! "
    story += "To their disappointment, it had turned out that the story they had found was " + adj1 + ". "
    story += "Frustrated with their efforts, and tired of the text based game, the player, " + name + " promptly quit the game. "
    story += "The End."
    print story
    
def help():
    print "-----HINTS-----"
    print "1) The first number is the first number you see!"
    print "2) The second numbers is a death count."
    print "3) The third number is the amount of of's in the Apocalypse"
    print "4) The final hint is the number of stories."
    print "5) If you figure out the code, just enter it in the menu!"
    print "---------------"
    
def run():
    displayStartScreen()
    choice = ""
    while choice != 'Q':
        choice = menu(6)
        if choice == '1':
            story1()
        elif choice == '2':
            story2()
        elif choice == '3':
            story3()
        elif choice == 'H':
            help()
        elif choice == '1464':
            storyS()
        elif choice == 'Q':
            displayEndScreen()
        else:
            print "Something Awful Ocurred...yell at programmer!"
    exit()

run()

